package com.pearl.web.demo.servlet;

import jakarta.servlet.ServletRequestEvent;
import jakarta.servlet.ServletRequestListener;
import jakarta.servlet.annotation.WebListener;
import org.springframework.stereotype.Component;

/**
 * @author TangDan
 * @version 1.0
 * @since 2023/3/20
 */
// 监听请求域对象
@WebListener
@Component// 也可使用@ServletComponentScan扫描
public class MyListener implements ServletRequestListener {

    @Override
    public void requestDestroyed(ServletRequestEvent sre) {
        System.out.println("---------销毁------------");
    }

    @Override
    public void requestInitialized(ServletRequestEvent sre) {
        System.out.println("----------初始化-----------");
    }
}
